package asteroids.model.programs.parsing.types;

import be.kuleuven.cs.som.annotate.Basic;
import asteroids.model.SpaceObject;

public class EntityLiteral extends Type {

	public EntityLiteral(SpaceObject spaceObject) {
		this.spaceObject=spaceObject;
	}

	public EntityLiteral(){
		this.spaceObject=null;
	}

	@Basic
	public SpaceObject getValue() {
		return spaceObject;
	}

	private SpaceObject spaceObject;

	@Override
	public String toString(){
		if(spaceObject!=null){
			return(spaceObject.toString());
		}
		return "No spaceobject";
	}

	@Override
	public boolean equals(Object object){
		if(!(object instanceof EntityLiteral)){
			return false;
		}
		return ((((EntityLiteral) object).getValue()==spaceObject)
				|| ((spaceObject==null) && (((EntityLiteral) object).getValue()==null)));
	}

	@Override
	public int hashCode(){
		return spaceObject.hashCode();
	}
}
